import Router from 'vue-router'
export default new Router({
  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      if (from.meta.keepAlive) {
        from.meta.savedPosition = document.body.scrollTop;
      }
        return { x: 0, y: to.meta.savedPosition ||0}
    }
  },
  routes: [
    {
      path: '/',
      name: '首页',
      component: () => import('views/merchants/index')
    }, {
      path:'/search',
      name: '搜索',
      component: () => import('views/search/index')
    },{
      path: '/merchantslist',
      name: '',
      component: () => import('views/merchants/list')
    }, {
      path: '/shangjia',
      name: '',
      component: () => import('views/shangjia/index')
    },{
      path: '/comment',
      name: '',
      component: () => import('views/shangjia/comment')
    },{
      path: '/preview',
      name: '',
      component: ()=>import('views/shop/preview')
    },{
      path: '/goods',
      name: '',
      component: () => import('views/shop/shop')
    }, {
      path: '/goods/confirmOrder',
      name: '确认订单',
      component: () => import('views/shop/confirmOrder')
    }, {
      path: '/goods/orderComplete',
      name: '订单完成',
      component: () => import('views/shop/order_complete')
    }, {
      path: '/goods/orderComplete/evaluate',
      name: '评价',
      component: ()=>import('views/shop/evaluate')
    },{
      path: '/goods/confirOrder/remark',
      name: '',
      component: () => import('views/shop/remark')
    },{
      path: '/order',
      name: '我的订单',
      component: () => import('views/order/index')
    }, {
      path: '/me',
      name: '个人中心',
      component: () => import('views/me/index')
    },{
      path: '/me/bindMobile',
      name: '绑定手机',
      component: ()=>import('views/me/bindMobile')
    },{
      path: '/me/coupon',
      name: '优惠券',
      component: ()=>import('views/me/coupon')
    },{
      path: '/login',
      name: '商户后台',
      component: () => import('views/user/login')
    },{
      path: '/bindOpenId',
      name: '接单微信绑定',
      component: () => import('views/user/bind')
    },{
      path: '/shop/order',
      name: '商户订单',
      component: ()=>import('views/user/order')
    },{
      path: '/nativeto',
      name: '',
      component: ()=>import('views/nativeto/index')
    }]
})
